<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>JSONP__本域之外的一些数据</title>
    <!--JSONP走GET-->
    <script src="../../vue.js"></script>
    <script src="../vue-resource.js"></script>
    <style>
    </style>
    <script>
        window.onload=function () {
            new Vue({
                el:'body',
                data: {
                },
                methods:{
                    get:function () {
                        // emulateJSON发送数据post请求
                        this.$http.jsonp("https://sp0.baidu.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su", {
                            wd:'aa'
                        },
                            {
                                jsonp:"cb"
                            })
                            .then(function (res) {
                            //成功
                                //改端口 会输出3
                            alert(res.data.s);//a.txt++welcome to VUE-ajax
                                // res.data.s;
                        },function (res) {
                            //失败
                            alert('failed');
                            alert(res.status);//404
                        })
                    }
                }
            });
        };
    </script>
</head>
<body>
<input type="button" value="按钮" @click="get()">
</body>
</html>